﻿using Abp.AspNetCore;
using Abp.Dapper;
using Abp.Dependency;
using Abp.EntityFrameworkCore;
using Abp.Modules;
using Abp.Reflection.Extensions;
using Batman.Cms.Core.Configurations;
using Batman.Cms.Core.Core.SimpleMaintenance.Repositories;
using Batman.Cms.Core.Services;
using Batman.Cms.Core.Tools;

namespace Batman.Cms.Core
{
    [DependsOn(typeof(AbpEntityFrameworkCoreModule),
        typeof(AbpAspNetCoreModule),
        typeof(AbpDapperModule)
        //typeof(AbpAutoMapperModule)
        )]
    public class BatmanCoreModule : AbpModule
    {
        public override void PreInitialize()
        {
            base.PreInitialize();
        }
        public override void Initialize()
        {
            IocManager.Register<UpYunConfigurations, UpYunConfigurations>(DependencyLifeStyle.Singleton);
            IocManager.Register<UpYunTool, UpYunTool>(DependencyLifeStyle.Singleton);

            IocManager.Register(typeof(BaseManager<>), DependencyLifeStyle.Transient);
            IocManager.Register(typeof(BaseReader<>), DependencyLifeStyle.Transient);
            IocManager.RegisterAssemblyByConvention(typeof(BatmanCoreModule).GetAssembly());
            IocManager.Register(typeof(MaintenanceRepository<>), DependencyLifeStyle.Transient);
        }
    }
}
